import request from '@/utils/request'

// 获取客户列表
export function getClientList(params) {
  return request({
    url: '/clients',
    method: 'get',
    params: params
  })
}

// 新建客户
export function addClient(data) {
  return request({
    url: '/clients',
    method: 'post',
    data
  })
}

// 删除客户
export function delClient(id) {
  return request({
    url: '/clients/' + id,
    method: 'delete'
  })
}

// 获取经纪列表
export function getAgents() {
  return request({
    url: '/agents',
    method: 'get'
  })
}

// 获取指定用户
export function getOnceCli(id) {
  return request({
    url: '/clients/' + id

  })
}

// 编辑客户
export function editClients(data) {
  return request({
    url: '/clients/' + data.id,
    method: 'put',
    data
  })
}

// 登录
export function login(data) {
  return request({
    url: '/auth/local',
    method: 'post',
    data
  })
}

export function register(data) {
  return request({
    url: '/auth/local/register',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/users/me',
    method: 'get'
  })
}

export function getPerm() {
  return request(`/mypermissions`)
}
// 获取客户数量
export function getClientTotal(params) {
  return request({
    url: '/clients/count',
    method: 'get',
    params
  })
}

